package com.example.blog.mapper;

import com.example.blog.model.BlogInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface BlogMapper {
    @Select("select * from blog where delete_flag=0")
    List<BlogInfo> selectAll();

    //根据博客id查询博客信息
    @Select("select * from blog where delete_flag=0 and id = #{id}")
    BlogInfo selectBlodId(Integer id);

    //插入博客
    @Insert("insert into blog (title,content,user_id)values (#{title},#{content},#{userId})")
    Integer insertBlog(BlogInfo blogInfo);

    //跟新博客

    Integer updateBlog(BlogInfo blogInfo);



}
